/* --- 基础样式 --- */
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f4f9;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    min-height: 100vh;
    margin: 0;
}

.todo-container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
}

/* --- 表单样式 --- */
#todo-form {
    display: flex;
    margin-bottom: 20px;
}

#todo-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px 0 0 4px;
    font-size: 16px;
}

#todo-form button {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    transition: background-color 0.3s;
}

#todo-form button:hover {
    background-color: #0056b3;
}

/* --- 任务列表样式 --- */
#todo-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 12px 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s;
}

.todo-item:last-child {
    border-bottom: none;
}

.todo-item span {
    flex: 1;
    cursor: pointer;
    user-select: none; /* 防止双击选中文本 */
}

.todo-item.completed span {
    text-decoration: line-through;
    color: #aaa;
}

.delete-btn {
    background-color: #dc3545;
    color: #fff;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    visibility: hidden; /* 默认隐藏 */
    opacity: 0;
    transition: opacity 0.3s, visibility 0.3s;
}

.todo-item:hover .delete-btn {
    visibility: visible; /* 鼠标悬停时显示 */
    opacity: 1;
}